home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 April / enter-2004-04.iso / files / httrack-3.30.exe / {app} / src / htsglobal.h < prev    next >
Encoding:
C/C++ Source or Header  |  2003-10-11  |  9.0 KB  |  454 lines

  1. /* ------------------------------------------------------------ */
  2. /*
  3. HTTrack Website Copier, Offline Browser for Windows and Unix
  4. Copyright (C) Xavier Roche and other contributors
  5.  
  6. This program is free software; you can redistribute it and/or
  7. modify it under the terms of the GNU General Public License
  8. as published by the Free Software Foundation; either version 2
  9. of the License, or any later version.
  10.  
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with this program; if not, write to the Free Software
  18. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  19.  
  20.  
  21. Important notes:
  22.  
  23. - We hereby ask people using this source NOT to use it in purpose of grabbing
  24. emails addresses, or collecting any other private information on persons.
  25. This would disgrace our work, and spoil the many hours we spent on it.
  26.  
  27.  
  28. Please visit our Website: http://www.httrack.com
  29. */
  30.  
  31.  
  32. /* ------------------------------------------------------------ */
  33. /* File: Global #define file                                    */
  34. /* Author: Xavier Roche                                         */
  35. /* ------------------------------------------------------------ */
  36.  
  37. // Fichier rΘunissant l'ensemble des defines
  38.  
  39. #ifndef HTTRACK_GLOBAL_DEFH
  40. #define HTTRACK_GLOBAL_DEFH
  41.  
  42. // Version
  43. #define HTTRACK_VERSION      "3.30"
  44. #define HTTRACK_VERSIONID    "3.30.01"
  45. #define HTTRACK_AFF_VERSION  "3.x"
  46. //#define HTTRACK_AFF_WARNING  "This is a BETA release of WinHTTrack Website Copier ("HTTRACK_VERSION")\nPlease report any crashes, bugs or problems"
  47.  
  48.  
  49.  
  50. // DΘfinition plate-forme
  51. #include "htssystem.h"
  52. #include "htsconfig.h"
  53.  
  54. // config.h
  55. #ifdef _WIN32
  56.  
  57. #define HAVE_SYS_STAT_H 1
  58. #define HAVE_SYS_TYPES_H 1
  59. #define HAVE_SYS_STAT_H 1
  60. #ifndef DLLIB
  61. #define DLLIB 1
  62. #endif
  63. #ifndef HTS_INET6
  64. #define HTS_INET6 1
  65. #endif
  66. #ifndef S_ISREG
  67. #define S_ISREG(m) ((m) & _S_IFREG)
  68. #endif
  69.  
  70. #else
  71.  
  72. #include "config.h"
  73.  
  74. #ifndef FTIME
  75. #define HTS_DO_NOT_USE_FTIME
  76. #endif
  77.  
  78. #ifndef SETUID
  79. #define HTS_DO_NOT_USE_UID
  80. #endif
  81.  
  82. #ifndef HTS_LONGLONG
  83. #ifdef SIZEOF_LONG_LONG
  84. #if SIZEOF_LONG_LONG==8
  85. #define HTS_LONGLONG 1
  86. #endif
  87. #endif
  88.  
  89. #ifndef HTS_LONGLONG
  90. #ifdef __sun
  91. #define HTS_LONGLONG 0
  92. #endif
  93. #ifdef __osf__
  94. #define HTS_LONGLONG 0
  95. #endif
  96. #ifdef __linux
  97. #define HTS_LONGLONG 1
  98. #endif
  99. #ifdef _WIN32
  100. #define HTS_LONGLONG 1
  101. #endif
  102. #endif
  103. #endif
  104.  
  105. #ifdef DLLIB
  106. #define HTS_DLOPEN 1
  107. #else
  108. #define HTS_DLOPEN 0
  109. #endif
  110.  
  111. #endif
  112.  
  113.  
  114. // Socket windows ou socket unix
  115. #ifdef _WIN32
  116. #undef HTS_PLATFORM
  117. #define HTS_PLATFORM 1
  118. #define HTS_WIN 1
  119.  
  120. #else
  121.  
  122. #define HTS_WIN 0
  123. #ifdef __linux
  124. #undef HTS_PLATFORM
  125. #define HTS_PLATFORM 3
  126. #endif
  127. #endif
  128.  
  129. // compatibilitΘ DOS
  130. #if HTS_WIN
  131. #define HTS_DOSNAME 1
  132. #else
  133. #define HTS_DOSNAME 0
  134. #endif
  135.  
  136. // utiliser zlib?
  137. #ifndef HTS_USEZLIB
  138. // autoload
  139. #define HTS_USEZLIB 1
  140. #endif
  141.  
  142. #ifndef HTS_INET6
  143. #define HTS_INET6 0
  144. #endif
  145.  
  146. // utiliser openssl?
  147. #ifndef HTS_USEOPENSSL
  148. // autoload
  149. #define HTS_USEOPENSSL 1
  150. #endif
  151.  
  152. #ifndef HTS_DLOPEN
  153. #define HTS_DLOPEN 1
  154. #endif
  155.  
  156. #ifndef HTS_USESWF
  157. #define HTS_USESWF 1
  158. #endif
  159.  
  160. #if HTS_WIN
  161. #else
  162. #define __cdecl
  163. #endif
  164.  
  165. #ifdef HTS_ANALYSTE_CONSOLE
  166. #undef HTS_ANALYSTE_CONSOLE
  167. #define HTS_ANALYSTE_CONSOLE 1
  168. #endif
  169.  
  170. #if HTS_ANALYSTE
  171. #else
  172. #if HTS_WIN
  173. #else
  174. #undef HTS_ANALYSTE
  175. // Analyste
  176. #define HTS_ANALYSTE 1
  177. #define HTS_ANALYSTE_CONSOLE 1
  178. #endif
  179. #endif
  180.  
  181.  
  182. /* rc file */
  183. #if HTS_WIN
  184. #define HTS_HTTRACKRC "httrackrc"
  185. #else
  186.  
  187. #ifndef HTS_ETCPATH
  188. #define HTS_ETCPATH "/etc"
  189. #endif
  190. #ifndef HTS_BINPATH
  191. #define HTS_BINPATH "/usr/bin"
  192. #endif
  193. #ifndef HTS_LIBPATH
  194. #define HTS_LIBPATH "/usr/lib"
  195. #endif
  196. #ifndef HTS_PREFIX
  197. #define HTS_PREFIX "/usr"
  198. #endif
  199.  
  200. #define HTS_HTTRACKRC ".httrackrc"
  201. #define HTS_HTTRACKCNF HTS_ETCPATH"/httrack.conf"
  202.  
  203. #ifdef DATADIR
  204. #define HTS_HTTRACKDIR DATADIR"/httrack/"
  205. #else
  206. #define HTS_HTTRACKDIR HTS_PREFIX"/share/httrack/"
  207. #endif
  208.  
  209. #endif
  210.  
  211. /* Gestion des tables de hashage */
  212. #define HTS_HASH_SIZE 20147
  213. /* Taille max d'une URL */
  214. #define HTS_URLMAXSIZE 1024
  215. /* Taille max ligne de commande (>=HTS_URLMAXSIZE*2) */
  216. #define HTS_CDLMAXSIZE 1024
  217. /* Copyright (C) Xavier Roche and other contributors */
  218. #define HTTRACK_AFF_AUTHORS "[XR&CO'2003]"
  219. #define HTS_DEFAULT_FOOTER "<!-- Mirrored from %s%s by HTTrack Website Copier/"HTTRACK_AFF_VERSION" "HTTRACK_AFF_AUTHORS", %s -->"
  220. #define HTTRACK_WEB "http://www.httrack.com"
  221. #define HTS_UPDATE_WEBSITE "http://www.httrack.com/update.php3?Product=HTTrack&Version="HTTRACK_VERSIONID"&VersionStr="HTTRACK_VERSION"&Platform=%d&Language=%s"
  222.  
  223. #define H_CRLF "\x0d\x0a"
  224. #define CRLF   "\x0d\x0a"
  225. #if HTS_WIN
  226. #define LF "\x0d\x0a"
  227. #else
  228. #define LF "\x0a"
  229. #endif
  230.  
  231. /* Θquivaut α "paramΦtre vide", par exemple -F (none) */
  232. #define HTS_NOPARAM "(none)"
  233. #define HTS_NOPARAM2 "\"(none)\""
  234.  
  235. /* maximum et minimum */
  236. #define maximum(A,B) ( (A) > (B) ? (A) : (B) )
  237. #define minimum(A,B) ( (A) < (B) ? (A) : (B) )
  238.  
  239. /* chaine vide? */
  240. #define strnotempty(A) (((A)[0]!='\0') ? 1 : 0)
  241.  
  242. /* optimisation inline si possible */
  243. #ifdef __cplusplus
  244. #define HTS_INLINE inline
  245. #else
  246. #define HTS_INLINE
  247. #endif
  248.  
  249. #ifdef _WIN32
  250. #ifdef LIBHTTRACK_EXPORTS
  251. #define HTSEXT_API __declspec(dllexport)
  252. #else
  253. #define HTSEXT_API __declspec(dllimport)
  254. #endif
  255. #else
  256. #define HTSEXT_API 
  257. #endif
  258.  
  259. #ifndef HTS_LONGLONG
  260. #ifdef HTS_NO_64_BIT
  261. #define HTS_LONGLONG 0
  262. #else
  263. #define HTS_LONGLONG 1
  264. #endif
  265. #endif
  266.  
  267. // long long int? (or int)
  268. // (and int cast for system functions like malloc() )
  269.  
  270. #if HTS_LONGLONG
  271. #ifdef LLINT_FORMAT
  272.   typedef LLINT_TYPE LLint;
  273.   typedef LLINT_TYPE TStamp;
  274.   #define LLintP LLINT_FORMAT
  275. #else
  276.  #if HTS_WIN
  277.   typedef __int64 LLint;
  278.   typedef __int64 TStamp;
  279.   #define LLintP "%I64d"
  280.  #else
  281.  #if HTS_PLATFORM==0
  282.   typedef long long int LLint;
  283.   typedef long long int TStamp;
  284.   #define LLintP "%lld"
  285.  #else
  286.   typedef long long int LLint;
  287.   typedef long long int TStamp;
  288.   #define LLintP "%Ld"
  289.  #endif
  290.  #endif
  291. #endif
  292. #else
  293.  typedef int LLint;
  294.  #define LLintP "%d"
  295.  typedef double TStamp;
  296. #endif
  297.  
  298. #ifdef LFS_FLAG
  299. typedef LLint INTsys;
  300. #define INTsysP LLintP
  301. #ifdef __linux
  302. #define HTS_FSEEKO
  303. #endif
  304. #else
  305. typedef int INTsys;
  306. #define INTsysP "%d"
  307. #endif
  308.  
  309. /* Default alignement */
  310. #ifndef HTS_ALIGN
  311. #define HTS_ALIGN (sizeof(void*))
  312. #endif
  313.  
  314. /* IPV4, IPV6 and various unified structures */
  315. #define HTS_MAXADDRLEN 64
  316.  
  317. #if HTS_WIN
  318. #else
  319. #define __cdecl 
  320. #endif
  321.  
  322. /* mode pour mkdir ET chmod (accΦs aux fichiers) */
  323. #define HTS_PROTECT_FOLDER (S_IRUSR|S_IWUSR|S_IXUSR)
  324. #if HTS_ACCESS
  325. #define HTS_ACCESS_FILE (S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)
  326. #define HTS_ACCESS_FOLDER (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)
  327. #else
  328. #define HTS_ACCESS_FILE (S_IRUSR|S_IWUSR)
  329. #define HTS_ACCESS_FOLDER (S_IRUSR|S_IWUSR|S_IXUSR)
  330. #endif
  331.  
  332. /* vΘrifier la dΘclaration des variables prΘprocesseur */
  333. #ifndef HTS_DOSNAME
  334. #error | HTS_DOSNAME Has not been defined.
  335. #error | Set it to 1 if you are under DOS, 0 under Unix.
  336. #error | Example: place this line in you source, before includes:
  337. #error | #define HTS_DOSNAME 0
  338. #error
  339. #error
  340. #endif
  341. #ifndef HTS_ACCESS
  342. /* Par dΘfaut, accΦs α tous les utilisateurs */
  343. #define HTS_ACCESS 1
  344. #endif
  345.  
  346. /* fflush sur stdout */
  347. #define io_flush { fflush(stdout); fflush(stdin); }
  348.  
  349.  
  350.  
  351. /* HTSLib */
  352.  
  353. // Cache DNS, accΘlΦre les rΘsolution d'adresses
  354. #define HTS_DNSCACHE 1
  355.  
  356. // ID d'une pseudo-socket locale pour les file://
  357. #define LOCAL_SOCKET_ID -500000
  358.  
  359. // taille de chaque buffer (10 sockets 650 ko)
  360. #define TAILLE_BUFFER 65535
  361.  
  362. #if HTS_WIN
  363. #else
  364. // use pthreads.h
  365.  
  366. #ifndef THREADS
  367. #define HTS_DO_NOT_USE_PTHREAD
  368. #endif
  369.  
  370. #ifdef HTS_DO_NOT_USE_PTHREAD
  371. #define USE_PTHREAD 0
  372. #else
  373. #define USE_PTHREAD 1
  374. #endif
  375. #endif
  376.  
  377. #if HTS_WIN
  378. #define USE_BEGINTHREAD 1
  379. #else
  380. #if USE_PTHREAD
  381. #define USE_BEGINTHREAD 1
  382. #else
  383. /* sh*t.. */
  384. #define USE_BEGINTHREAD 0
  385. #endif
  386. #endif
  387.  
  388. #ifdef _DEBUG
  389. // trace mallocs
  390. //#define HTS_TRACE_MALLOC
  391. #ifdef HTS_TRACE_MALLOC
  392. typedef unsigned long int t_htsboundary;
  393. typedef struct _mlink {
  394.   char* adr;
  395.   int len;
  396.   int id;
  397.   struct _mlink* next;
  398. } mlink;
  399. static const t_htsboundary htsboundary = 0xDEADBEEF;
  400. #endif
  401. #endif
  402.  
  403. /* strxxx debugging */
  404. #ifndef NOSTRDEBUG
  405. #define STRDEBUG 1
  406. #endif
  407.  
  408.  
  409. /* ------------------------------------------------------------ */
  410. /* Debugging                                                    */
  411. /* ------------------------------------------------------------ */
  412.  
  413. // dΘbuggage types
  414. #define DEBUG_SHOWTYPES 0
  415. // backing debug
  416. #define BDEBUG 0
  417. // chunk receive
  418. #define CHUNKDEBUG 0
  419. // realloc links debug
  420. #define MDEBUG 0
  421. // cache debug
  422. #define DEBUGCA 0
  423. // DNS debug
  424. #define DEBUGDNS 0
  425. // savename debug
  426. #define DEBUG_SAVENAME 0
  427. // debug robots
  428. #define DEBUG_ROBOTS 0
  429. // debug hash
  430. #define DEBUG_HASH 0
  431. // VΘrification d'intΘgritΘ
  432. #define DEBUG_CHECKINT 0
  433. // nbr sockets debug
  434. #define NSDEBUG 0
  435.  
  436. // dΘbuggage HTSLib
  437. #define HDEBUG 0
  438. // surveillance de la connexion
  439. #define CNXDEBUG 0
  440. // debuggage cookies
  441. #define DEBUG_COOK 0
  442. // dΘbuggage hard..
  443. #define HTS_WIDE_DEBUG 0
  444. // debuggage deletehttp et cie
  445. #define HTS_DEBUG_CLOSESOCK 0
  446. // debug tracage mΘmoire
  447. #define MEMDEBUG 0
  448.  
  449. // htsmain
  450. #define DEBUG_STEPS 0
  451.  
  452. #endif
  453.  
  454.